//
//  CTCRapidAnswerCell.m
//  CTC
//
//  Created by 李小龙 on 2017/3/21.
//  Copyright © 2017年 jieshuibao. All rights reserved.
//

#import "CTCRapidAnswerCell.h"

@interface CTCRapidAnswerCell ()


@property (weak, nonatomic) IBOutlet UIImageView *headImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property (weak, nonatomic) IBOutlet UILabel *dateLabel;
@property (weak, nonatomic) IBOutlet UILabel *addQuestionContentLabel;
@property (weak, nonatomic) IBOutlet UILabel *addAnswerContentLabel;

@property (weak, nonatomic) IBOutlet UILabel *posiationLabel;
@property (weak, nonatomic) IBOutlet UILabel *companyLabel;
@property (weak, nonatomic) IBOutlet UIView *addQuestionView;

@property (weak, nonatomic) IBOutlet UIView *addAnswerView;


@property (weak, nonatomic) IBOutlet NSLayoutConstraint *addQustionHeadHeightLayout;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *addQuestionTopLayout;



@property (weak, nonatomic) IBOutlet NSLayoutConstraint *addAnswerHeadHeightLayout;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *addAnswerTopLayout;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *addAnswerBottomLayout;


@property (weak, nonatomic) IBOutlet NSLayoutConstraint *adoptBtnBottomLayout;

@property (weak, nonatomic) IBOutlet UILabel *addQuestionTitleLabel;

@property (weak, nonatomic) IBOutlet UILabel *addAnswerTitleLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *replyBtnTopHeighLayout;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *replyBtHeightLayout;

@end

@implementation CTCRapidAnswerCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
}


- (void)setAnswerModel:(CTCAnswerModel *)answerModel
{
    _answerModel = answerModel;
    
    [SDWebImageTool imageView:self.headImageView imageName:[CTCUserModel shareUser].detailModel.headImg placeHolder:@"default-head" showProgress:NO];
    self.nameLabel.text = [CTCUserModel shareUser].detailModel.name;
    self.dateLabel.text = [NSDate stringFromTimestamp:answerModel.date];
    self.contentLabel.text = answerModel.content;
    self.addQuestionContentLabel.text = answerModel.askedContent;
    self.addAnswerContentLabel.text = answerModel.askedAnswer;
    self.companyLabel.text = [CTCUserModel shareUser].detailModel.fname;
    self.posiationLabel.text = [CTCUserModel shareUser].detailModel.position;
    
    if (answerModel.stage < 2) {
        self.adoptBtnBottomLayout.constant = 5;
        self.addQuestionTitleLabel.text = @"";
        self.addQustionHeadHeightLayout.constant = 0;
        self.addQuestionTopLayout.constant = 0;
        
        self.replyBtHeightLayout.constant = 0;
        self.replyBtnTopHeighLayout.constant =  0;
        self.addAnswerTitleLabel.text = @"";
        self.addAnswerHeadHeightLayout.constant = 0;
        self.addAnswerTopLayout.constant = 0;
        self.addAnswerBottomLayout.constant = 0;
    }
    else if (answerModel.stage == 2 ) {
        
        self.addQuestionTitleLabel.text = @"用户追问";
        self.addQustionHeadHeightLayout.constant = 30;
        self.addQuestionTopLayout.constant = 14;
        
        self.addAnswerTitleLabel.text = @"";
        self.addAnswerHeadHeightLayout.constant = 0;
        self.addAnswerTopLayout.constant = 0;
        self.addAnswerBottomLayout.constant = 0;
        
        
    }
    else {
        self.addQuestionTitleLabel.text = @"用户追问";
        self.addQustionHeadHeightLayout.constant = 30;
        self.addQuestionTopLayout.constant = 14;
        
        self.replyBtHeightLayout.constant = 0;
        self.replyBtnTopHeighLayout.constant =  0;
        self.addAnswerTitleLabel.text = @"咨询师回答";
        self.addAnswerHeadHeightLayout.constant = 30;
        self.addAnswerTopLayout.constant = 14;
        self.addAnswerBottomLayout.constant = 14;
    }
    
}



- (IBAction)replyBtnClick {
    if (self.replyBtnClickBlock) {
        self.replyBtnClickBlock();
    }
}


@end
